#include "main.h"
int main(int argc, char *argv[])
{
    glutInit(&argc, argv);
    glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
    // glutInitWindowPosition(770, 400);
    glutCreateWindow(PROGRAM_NAME);
    glutDisplayFunc(&onRenderScene);
    glutIdleFunc(idle);
    inital();
    glutMainLoop();
    return 0;
}

void onRenderScene(void)
{
    // 使用当前颜色清空缓冲区,即设定背景颜色
    glClear(GL_COLOR_BUFFER_BIT);
    // 设定画笔颜色
    glColor3f(1, 0, 0);
    // glColor3f(76.0/255, 180.0/255, 231.0/255);

    Bresenham(Point(100, 200), Point(0, 0));
    MidBresenham(Point(0, 0),Point(200, 200) );
    // MidBresenham(Point(200, 100), Point(0, 0));
    Bresenham(Point(300, 200) ,Point(0, 0) );
    MidBresenhamCircle(Point(200, 200),20);
    MidBresenhamEllipse(Point(200, 200),100,50);

    glFlush();
}

void inital()
{
    // 定义窗体尺寸
    windowWidth = WINDOW_SIZE;
    windowHeight = WINDOW_SIZE;
    gluOrtho2D(0, windowWidth, 0, windowHeight);

    glClearColor(1, 1, 1, 1);
}
void idle(void) //空闲函数
{
    glutPostRedisplay();
}